﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using ManagementClinic.App.ViewModel;
using System.Windows.Input;

namespace ManagementClinic.App.Common
{
    public abstract class ViewModelBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        public ICommand saveCommand;
        public ICommand clearCommand;
        public ICommand deleteCommand;
        public ICommand cancelCommand;
        public ICommand selectAllCommand;
        public ICommand searchCommand;
        private int selectionPageValue;
        private int selectionPageViewValue;
        private List<Page> pageSource;
        private List<Page> pageViewSource;
        public int TotalItem = 0;
        public int TotalPage = 1;
        public string TotalPageItem
        {
            get { return String.Format("{0} bản ghi  |", TotalItem); }
            set
            {
                OnPropertyChanged("TotalItem");
            }
        }
        public int SelectionPageValue
        {
            get { return selectionPageValue; }
            set
            {
                selectionPageValue = value;
                OnPropertyChanged("SelectionPageValue");
            }
        }
        public int SelectionPageViewValue
        {
            get { return selectionPageViewValue; }
            set
            {
                selectionPageViewValue = value;
                OnPropertyChanged("SelectionPageViewValue");
            }
        }
        public List<Page> PageSource
        {
            get { return pageSource; }
            set
            {
                pageSource = value;
                OnPropertyChanged("PageSource");
            }
        }
        public List<Page> PageViewSource
        {
            get { return pageViewSource; }
            set
            {
                pageViewSource = value;
                OnPropertyChanged("PageViewSource");
            }
        }

        private bool checkedAll;
        public bool CheckedAll
        {
            get { return checkedAll; }
            set
            {
                checkedAll = value;
                OnPropertyChanged("CheckedAll");
            }
        }

        private bool _checked;
        public bool Checked
        {
            get { return _checked; }
            set
            {
                _checked = value;
                OnPropertyChanged("Checked");
            }
        }
        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
        public Mode Mode{get;set;}


    }
}
